<template>
	<div class="avatar-container" :style="{ width: size + 'px', height: size + 'px' }">
		<img class="avatart-img" :src="reUrl" alt="暂缺显示" />
	</div>
</template>

<script>
import { url as baseUrl } from '@/urlConfig'
export default {
	props: {
		url: {
			type: String,
			required: true,
		},
		size: {
			type: Number,
			default: 50,
		},
	},
	computed: {
		reUrl() {
			if (this.url.startsWith(baseUrl)) {
				return this.url
			} else {
				return baseUrl + this.url
			}
		},
	},
}
</script>

<style lang="less" scoped>
.avatart-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}
</style>
